<? 
	if(isset($_POST['btnsubmit']))
	{
		require("required/dbconnect.php");
		$bid=$_POST['bid'];
		$receiveddate=$_POST['receiveddate'];
		$survey1=$_POST['score'];
		$message=$_POST['message'];
		
		
				
		$update=mysql_query("update os_bill_details set goods_received_date='$receiveddate', status=6,survey_1=$survey1,review='$message' where id=$bid")or die(mysql_error());
		header("Location:os_closedbill.php?id=$bid");
	}
	$title="Received Goods";
	require("required/dbconnect.php");
	require("required/share_function.php");
	$_SESSION['pid']=3;
	require("required/header.php");
	require("required/chkuser.php"); 
	require("required/function.php"); 
	
	$bid=$_GET['id'];
	
	$get_bill=mysql_query("select * from os_bill_details where id=$bid and uid=$member_id");
	if(mysql_num_rows($get_bill)==0)
	{
?>
		<script language="javascript">
			window.location="os_invalid.php";
		</script>
<?	
	}
	$b=mysql_fetch_array($get_bill,MYSQL_ASSOC);
	
	if($b['status']!=5)
	{
?>
		<script language="javascript">
			window.location="os_invalid.php";
		</script>
<?	
	}
	$get_item=mysql_query("select * from os_bill_items where bid=$bid")or die("line 11".mysql_error());
?>

		
				<table width="100%">
					<td align="left" class="page_title_bar">
						<table width="100%">
							Goods received confirmation
							</td>						
						</table>
					</td>
					<tr>
						<Td height="400" valign="top">
							<form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm" method="post">
							<table width="100%">
							<script type="text/javascript" src="required/calendarDateInput.js"></script>		
							
							<tr>
								<td align="center">
									<table width="100%">
										<tr>
											<td colspan="3"><strong>Thank you very much for using our service. Please complete the survey below to help us serve you better in the future.</strong></td>
										</tr>
										<tr>
											<td width="20%">Order number</td><td width="1%">:</td><td width="79%"><?= $b['invoice_number'] ?>	</td>
										</tr>
										<?
											$create_date=strtotime($b['create_date']);
										?>
										<tr>
											<td width="20%">Order date</td><td width="1%">:</td><td width="79%"><?= date("Y-m-d",$create_date) ?></td>
										</tr>
										<tr>
											<td>Received date</td><td width="1%">:</td><td><script>DateInput('receiveddate', true, 'YYYY-MM-DD')</script></td>
										</tr>
										<tr valign="top">
											<td>Rate our service</td><td width="1%">:</td>
											<td style="font-size:10px ">
											<input type="radio" name="score" value="5">5(very good) 
											<input type="radio" name="score" value="4">4(not bad) 
											<input type="radio" name="score" value="3" checked>3(normal) 
											<input type="radio" name="score" value="2">2(not good)
											<input type="radio" name="score" value="1">1(very poor)
										</td>
										</tr>
										<tr valign="top">
											<td>Comments</td><td>:</td><td><input type="text" size="50" name="message" class="text" maxlength="100"> maximum 100 characters</td>
										</tr>
										
										
										<input type="hidden" value="<?= $bid ?>" name="bid">
										<tr>
										<td colspan="3" align="center"> <input type="submit" value="Submit" name="btnsubmit" class="button"> <input type="button" value="Back" class="button" onClick="history.go(-1)"></td>
										</tr>
									</table>
								</td>
							</tr>
							
					
				</table>
				</form>
				
			</Td>
		</tr>		  
	</table>

<? require("required/footer.php"); ?>	